/**
 * 功能描述 卡片
 */

define(function (require, exports, module) {
	var aw = require("ajaxwrapper");
	var Form = require("form");
    var instance = {
        initComponent : function (params, widget) {
            var form = new Form({
            	 parentNode: ".J-form",
            	 show : false,
            	 model:{
         			id: "form",
//                    defaultButton : false,
         			 cancelaction : function(){   
    	       			 widget.show([".J-grid"]).hide([".J-form"]);
    	       			 widget.get("subnav").show(["dateRange", "status", "servicePoint"]);
    					 widget.get("grid").refresh();
    	       		 },
    	       		saveaction : function(){
    	       			var data = form.getData();
						aw.saveOrUpdate("api/nonmembergroup/pay",data,function(data){
							widget.get("grid").refresh();
	   	       				widget.show([".J-grid"]).hide([".J-form"]);
    	       				widget.get("subnav").show(["dateRange", "status", "servicePoint"]);
	        			});
    	       		},
         			items:[{
         				name: "pkNonMemberGroup",
         				type: "hidden"
         			},{
         				name: "version",
         				type: "hidden"
         			},{
         				name:"groupUnit",
         				label:"组团单位",
         			},{
         				name:"startDate",
         				label:"开始日期",
         				type:"date"
         			},{
         				name:"endDate",
         				label:"结束日期",
         				type:"date"
         			},{
         				name:"deposit",
         				label:"应收订金"
         			},{
         				name:"money",
         				label:"实收订金"
         			}]
         		}
            });
            widget.set("form", form);
        }
    };
    module.exports = instance;
});
